import AdSearch from '@/components/AdSearch';
// import { queryPerson } from '@/utils/common';
import AdSelect from '@/components/AdSelect';

export const codes = {
  add: 'add',
  edit: 'edit',
};

export const formate = 'YYYY-MM-DD';
export const formateTime = 'YYYY-MM-DD HH:mm';
export const formateS = 'YYYY-MM-DD HH:mm:ss';

export const allDispatchType = {
  list: 'myOrder/selectKNTracks',
  mapTracks: 'myOrder/selectKNgMapTracks',
  value: 'myOrder/allValus',
};

export const routeUrl = {
  trail: '/portal/myOrder/trailList',
  trailMap: '/portal/corelle/myOrderList/trailMap',
};

export const allUrl = {
  //   customerList: 'api/User/User/GetCustomerList',
};

export function saveAllValues({ payload = {}, props } = {}) {
  const { dispatch } = props;
  dispatch({
    type: allDispatchType.value,
    payload,
  });
}

export function selectExportOSList({ payload = {}, props } = {}) {
  const { dispatch, searchValue } = props;
  dispatch({
    type: allDispatchType.list,
    payload,
    callback: data => {
      if (!data) return;
    },
  });
}

export function renderTableAdSelect({ key, data, value, props }) {
  let params = { onlyRead: true, value };
  if (key) {
    const { dictObject } = props;
    params = { data: dictObject[key], payload: { code: [key] }, ...params };
  } else {
    params = { data, ...params };
  }
  return <AdSelect {...params} />;
}

export function renderTableAdSearch({ value, props }) {
  const { searchValue } = props;
  if (!value || !searchValue) return '';
  const params = {
    onlyRead: true,
    value: searchValue[value],
    label: 'loginName',
    name: 'sysName',
  };
  return <AdSearch {...params} />;
}

//测试数据：
export const KNTracksList_demo = {
  pagination: {
    currentPage: 1, //currentPage区别不同平台传参数
    pageSize: 20,
    total: 750,
    pages: 10,
  },
  list: [
    {
      'Order No.': '27408',
      'Order Type': 'W',
      Tracking: '',
      Status: 'Order Created',
      'Delivery No.': 'PWT20040506',
      'Planned ship out': '2020/4/24 17:00:00',
      'Actual Ship out': '',
      'Transportation No.': '--------------------',
      'Order created': '2020/4/23 10:03:47',
      'Picking completed': '',
      'Packing completed': '',
      'Pickup address': '--------------------',
      Receiver: '--------------------',
      'Ship to address': '--------------------',
      'Planned Arrival Time': '--------------------',
      'Actual Arrival Time': '--------------------',
    },
    {
      'Order No.': '27402',
      'Order Type': 'T&W',
      Tracking: '',
      Status: 'Order Created',
      'Delivery No.': 'PWT20040501',
      'Planned ship out': '2020/4/24 17:00:00',
      'Actual Ship out': '',
      'Transportation No.': '',
      'Order created': '2020/4/23 10:03:40',
      'Picking completed': '',
      'Packing completed': '',
      'Pickup address': '庞金路2088号',
      Receiver: '天津莱博',
      'Ship to address': '南开区红旗南路500号',
      'Planned Arrival Time': '2020/4/25 17:00:00',
      'Actual Arrival Time': '',
    },
    {
      'Order No.': '27398',
      'Order Type': 'T&W',
      Tracking: '',
      Status: 'Order Created',
      'Delivery No.': 'PWT20040493',
      'Planned ship out': '2020/4/24 15:00:00',
      'Actual Ship out': '',
      'Transportation No.': '',
      'Order created': '2020/4/23 10:03:33',
      'Picking completed': '',
      'Packing completed': '',
      'Pickup address': '庞金路2088号',
      Receiver: '北京伊诺凯',
      'Ship to address': '朝阳区金盏乡长店村西',
      'Planned Arrival Time': '2020/4/25 17:00:00',
      'Actual Arrival Time': '',
    },
    {
      'Order No.': '27396',
      'Order Type': 'T&W',
      Tracking: '',
      Status: 'Picked',
      'Delivery No.': 'PWT20040487',
      'Planned ship out': '2020/4/24 12:00:00',
      'Actual Ship out': '',
      'Transportation No.': '',
      'Order created': '2020/4/23 10:03:25',
      'Picking completed': '2020/4/23 11:47:26',
      'Packing completed': '',
      'Pickup address': '庞金路2088号',
      Receiver: '深圳华大基因',
      'Ship to address': '盐田区北山工业区11栋1楼采供仓库',
      'Planned Arrival Time': '2020/4/25 17:00:00',
      'Actual Arrival Time': '',
    },
    {
      'Order No.': '27393',
      'Order Type': 'W',
      Tracking: '',
      Status: 'Packed',
      'Delivery No.': 'PWT20040485',
      'Planned ship out': '2020/4/24 12:00:00',
      'Actual Ship out': '',
      'Transportation No.': '--------------------',
      'Order created': '2020/4/22 16:43:17',
      'Picking completed': '2020/4/23 10:45:59',
      'Packing completed': '2020/4/23 11:55:41',
      'Pickup address': '--------------------',
      Receiver: '--------------------',
      'Ship to address': '--------------------',
      'Planned Arrival Time': '--------------------',
      'Actual Arrival Time': '--------------------',
    },
    {
      'Order No.': '27392',
      'Order Type': 'W',
      Tracking: '',
      Status: 'Ready to Ship',
      'Delivery No.': 'PWT20040483',
      'Planned ship out': '2020/4/24 12:00:00',
      'Actual Ship out': '',
      'Transportation No.': '--------------------',
      'Order created': '2020/4/22 16:33:53',
      'Picking completed': '2020/4/22 18:55:50',
      'Packing completed': '2020/4/23 10:24:52',
      'Pickup address': '--------------------',
      Receiver: '--------------------',
      'Ship to address': '--------------------',
      'Planned Arrival Time': '--------------------',
      'Actual Arrival Time': '--------------------',
    },
    {
      'Order No.': '27391',
      'Order Type': 'W',
      Tracking: '',
      Status: 'Ready to Ship',
      'Delivery No.': 'PWT20040481',
      'Planned ship out': '2020/4/23 15:00:00',
      'Actual Ship out': '',
      'Transportation No.': '--------------------',
      'Order created': '2020/4/22 14:15:29',
      'Picking completed': '2020/4/22 18:27:18',
      'Packing completed': '2020/4/22 19:34:56',
      'Pickup address': '庞金路2088号',
      Receiver: '上海百赛',
      'Ship to address': '上海市闵行区景联路189号5号楼',
      'Planned Arrival Time': '2020/4/23 18:00:00',
      'Actual Arrival Time': '',
    },
    {
      'Order No.': '27389',
      'Order Type': 'T&W',
      Tracking: '',
      Status: 'Packed',
      'Delivery No.': 'PWT20040480',
      'Planned ship out': '2020/4/23 15:00:00',
      'Actual Ship out': '',
      'Transportation No.': '',
      'Order created': '2020/4/22 13:02:52',
      'Picking completed': '2020/4/22 17:48:19',
      'Packing completed': '2020/4/22 18:55:53',
      'Pickup address': '庞金路2088号',
      Receiver: '广州华粤',
      'Ship to address': '番禺区南村镇兴南大道483号华粤仓库',
      'Planned Arrival Time': '2020/4/25 15:00:00',
      'Actual Arrival Time': '',
    },
    {
      'Order No.': '27388',
      'Order Type': 'W',
      Tracking: '',
      Status: 'Ready to Ship',
      'Delivery No.': 'PWT20040478',
      'Planned ship out': '2020/4/23 15:00:00',
      'Actual Ship out': '',
      'Transportation No.': '--------------------',
      'Order created': '2020/4/22 11:34:42',
      'Picking completed': '2020/4/22 13:21:37',
      'Packing completed': '2020/4/22 16:39:53',
      'Pickup address': '--------------------',
      Receiver: '--------------------',
      'Ship to address': '--------------------',
      'Planned Arrival Time': '--------------------',
      'Actual Arrival Time': '--------------------',
    },
    {
      'Order No.': '27387',
      'Order Type': 'T&W',
      Tracking: '',
      Status: 'Ready to Ship',
      'Delivery No.': 'PWT20040469',
      'Planned ship out': '2020/4/23 13:00:00',
      'Actual Ship out': '',
      'Transportation No.': '',
      'Order created': '2020/4/22 10:05:20',
      'Picking completed': '2020/4/22 12:26:43',
      'Packing completed': '2020/4/22 14:40:16',
      'Pickup address': '庞金路2088号',
      Receiver: '梅里亚',
      'Ship to address': '江苏泰州市祥泰路297号-江苏勃林格殷格翰生物制品有限公司（北门）',
      'Planned Arrival Time': '2020/4/23 17:00:00',
      'Actual Arrival Time': '',
    },
    {
      'Order No.': '27384',
      'Order Type': 'T&W',
      Tracking: '',
      Status: 'Shipped',
      'Delivery No.': 'PWT20040464',
      'Planned ship out': '2020/4/23 13:00:00',
      'Actual Ship out': '2020/4/23 10:03:25',
      'Transportation No.': '16092004200053',
      'Order created': '2020/4/21 19:04:17',
      'Picking completed': '2020/4/21 21:37:40',
      'Packing completed': '2020/4/22 10:08:24',
      'Pickup address': '庞金路2088号',
      Receiver: '济南汇世',
      'Ship to address': '山东省济南市历下区明湖东路787号保利大名湖8号楼东仓库（淘金网吧旁）',
      'Planned Arrival Time': '2020/4/24 17:00:00',
      'Actual Arrival Time': '',
    },
    {
      'Order No.': '27382',
      'Order Type': 'W',
      Tracking: '',
      Status: 'Shipped',
      'Delivery No.': 'PWT20040463',
      'Planned ship out': '2020/4/23 10:00:00',
      'Actual Ship out': '2020/4/23 10:24:47',
      'Transportation No.': '--------------------',
      'Order created': '2020/4/21 16:42:03',
      'Picking completed': '2020/4/21 17:55:38',
      'Packing completed': '2020/4/21 20:49:27',
      'Pickup address': '--------------------',
      Receiver: '--------------------',
      'Ship to address': '--------------------',
      'Planned Arrival Time': '--------------------',
      'Actual Arrival Time': '--------------------',
    },
    {
      'Order No.': '27379',
      'Order Type': 'T',
      Tracking: '',
      Status: 'Shipped',
      'Delivery No.': 'PWT20040457',
      'Planned ship out': '2020/4/22 16:00:00',
      'Actual Ship out': '2020/4/22 16:33:53',
      'Transportation No.': '16092004200056',
      'Order created': '--------------------',
      'Picking completed': '--------------------',
      'Packing completed': '--------------------',
      'Pickup address': '庞金路2088号',
      Receiver: '北京赛泰克',
      'Ship to address': '成都市锦江区科创路328号7栋2楼',
      'Planned Arrival Time': '2020/4/24 16:00:00',
      'Actual Arrival Time': '',
    },
    {
      'Order No.': '27378',
      'Order Type': 'T&W',
      Tracking: '',
      Status: 'Shipped',
      'Delivery No.': 'PWT20040461',
      'Planned ship out': '2020/4/22 16:00:00',
      'Actual Ship out': '2020/4/22 14:15:29',
      'Transportation No.': '16092004200051',
      'Order created': '2020/4/21 14:50:46',
      'Picking completed': '2020/4/21 18:10:36',
      'Packing completed': '2020/4/21 19:57:18',
      'Pickup address': '庞金路2088号',
      Receiver: '广州百赛',
      'Ship to address': '广东省广州市黄埔区科学城天丰路8号J4栋百赛生物仓库',
      'Planned Arrival Time': '2020/4/24 16:00:00',
      'Actual Arrival Time': '',
    },
    {
      'Order No.': '27376',
      'Order Type': 'T&W',
      Tracking: '',
      Status: 'Shipped',
      'Delivery No.': 'PWT20040442',
      'Planned ship out': '2020/4/22 16:00:00',
      'Actual Ship out': '2020/4/22 13:02:52',
      'Transportation No.': '16092004210031',
      'Order created': '2020/4/21 14:36:12',
      'Picking completed': '2020/4/21 17:23:13',
      'Packing completed': '2020/4/21 19:20:36',
      'Pickup address': '庞金路2088号',
      Receiver: '上海华粤',
      'Ship to address': '上海浦东新区航都路88号',
      'Planned Arrival Time': '2020/4/22 19:00:00',
      'Actual Arrival Time': '2020/4/22 16:44:24',
    },
  ],
};
